﻿using SSCAI.DAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SSCAI.Model
{
    public class HistoricData
    {
        public static List<WinModel> GetHistoricData()
        {
            var loDatas = HistoricDataHelper.LoadXmlFile().Root.Descendants("item");
            var index = loDatas.Count();
            return loDatas.Select(d => new WinModel
            {
                Issue = d.Attribute("issue").Value,
                Number4D = d.Attribute("lottery4d").Value,
                AddTime = d.Attribute("time").Value,
                IsCorrect = d.Attribute("iscorrect").Value == "y",
                count = Convert.ToInt32(d.Attribute("count").Value)

            }).OrderByDescending(l => l.Issue).ToList();
        }
    }
}
